Here you can search through the pages of this Namespace, their attachments and the files uploaded to the system.
Note: the results will only display the items you have permissions to read.
Code Structure
Scripting code consists of one or more statements that are executed by the script interpreter. Individual statements are separated by semicolons. White spaces (spaces, tabs, carriage returns, etc.) have no effect on how scripts are interpreted. Scripts are case-insensitive (e.g. sma is the same as SMA ). Statements can do the following: Perform a calculation. Assign a value or calculation to a variable name. Accept user input into a variable. Plot values on a chart in various different formats. Configure the chart. [...]
This walkthrough is intended to demonstrate the very basics of scripting. A chart script is composed of one or more script "statements". A statement can be either a mathematical function that produces a value, an assignment of a function to a variable to use later in the script, or a command instructing the scripting engine what or how to plot a value on chart. Before we get started, you should have a chart [...]
T4 [...]
[...] Index of the current bar being computed. This runs from 0 to COUNT - 1. COUNT Number of bars on the chart. BARPERCENT Percentage completion of the current bar. E.g. 15 minutes into a 1 hour bar would give 0.25 NUMERATOR The numerator of the market. DENOMINATOR The denominator of the market. TICKVALUE The tick value of the market. NIL Special "non-value" field. MARKETID The text market id. MARKETDESCRIPTION The text description of the market.
Operators
Arithmetic Operators Operator Description + Add - Subtract / Divide * Multiply [...]
The input function allows for user configuration of script parameters to customize a script on a chart. For example, a script that used a moving average would use the INPUT function to get the number of periods to use for the moving average. That would allow the same script to be used on multiple charts with different values for the number of periods.
Numeric Values INPUT( label >, number >, min value >, max value >) Function Parameters Parameter Description label > The label [...]
[...] average of the value over the specified number of periods using the specified moving average type.
Function Parameters Parameter Description value > The value to compute the moving average of. periods > The number of periods to compute the moving average over. MAType > The type of moving average to compute. MAType can be specified as follows: MAType Parameter Description MAType.SMA Simple moving average. MAType.SMMA Smoothed moving average. MAType.EMA Exponential moving average. MAType.LWMA Linear weighted moving [...]
Help on how to create custom chart indicators and studies. The Advanced Data and Charting package is required to create custom studies. Overview Function [...]
[...] create new script-based studies to add to your charts. To start, click the Add Study button on the chart to open the Add Study window. The Add Study window will open. Click the New Custom Study button to create a new script-based study. The window will change to following: Here you will select whether you would like to create an overlay or an indicator study. Overlay studies appear on the same chart panel as the price bars and their study values are in prices. Indicator studies appear in their own chart [...]
[...] specified tick value to a text representation of the price. Note: you cannot use the output of this function in any mathematical computation.
Function Parameters Parameter Description value > The tick value to convert to display text.
Note: You can use the @ shortcut instead of using the full formula name as well:
SUMMARY("Close: [...]
ACCUM( value > )
Accumulates (sums) a value over all the data points on the chart. Function Parameters Parameter Description value > The value field to compute.
Example:
x = 1;
ACCUM(x);
Example Data Date Open High Low Close Volume x ACCUM(x) 06/01/2011 75100 76050 74100 75875 106528 1 1 06/02/2011 75750 77000 75450 76650 81891 1 2 06/03/2011 76550 76900 75100 75200 80819 1 3 06/06/2011 75400 75800 73150 73175 82726 1 4 06/07/2011 73200 73775 72925 73675 72927 1 5 06/08/2011 73875 76650 73450 76275 113339 1 6 06/09/2011 [...]
MAX( value >, ... value n > )
Returns the largest of the specified values. Function Parameters Parameter Description value 1 to n > The values to evaluate.
Examples: MAX(5, 10, 9, 8)
Evaluates to 10
Back to the
MOD( value 1 >, value 2 > )
Returns the remainder of the division of value 1 by value 2.
Function Parameters Parameter Description value 1 > The value to divide. value 2 > The value to divide by. Back to the
MIN( value >, ... value n > )
Returns the smallest of the specified values. Function Parameters Parameter Description value 1 to n > The values to evaluate.
Examples: MIN(5, 10, 9, 8)
Evaluates to 5
Back to the
[...] )
Returns the lowest value occurring over the last number of periods from the current data point. Function Parameters Parameter Description value > The value field to inspect (e.g. CLOSE , HIGH , (H+L+C)/3 , etc.) periods > The number of periods to look back.
Example: LOWEST(CLOSE, 5) Example Data Date Open High Low Close Volume LOWEST(CLOSE, 5) 06/01/2011 75100 76050 74100 75875 106528 75875 06/02/2011 75750 77000 75450 76650 81891 75875 06/03/2011 76550 76900 75100 75200 80819 75200 06/06/2011 75400 75800 73150 73175 82726 73175 06/07/2011 73200 [...]
LOG10( value > )
Computes the base 10 logarithm of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
[...]
Computes the standard deviation (entire population) of the value over the specified number of periods.
Function Parameters Parameter Description value > The value to compute the standard deviation of. periods > The number of periods to compute the standard deviation over. Back to the
[...] >, periods > )
Computes the standard deviation of the value over the specified number of periods.
Function Parameters Parameter Description value > The value to compute the standard deviation of. periods > The number of periods to compute the standard deviation over. Back to the
SUM( value >, periods > )
Computes the sum of the values over the specified number of periods. Function Parameters Parameter Description value > The value field to compute (e.g. CLOSE , HIGH , (H+L+C)/3 , etc.) periods > The number of periods to sum over.
Example: SUM(VOLUME, 5) Example Data Date Open High Low Close Volume SUM(VOLUME, 5) 06/01/2011 75100 76050 74100 75875 106528 06/02/2011 75750 77000 75450 76650 81891 06/03/2011 76550 76900 75100 75200 80819 06/06/2011 75400 75800 73150 73175 82726 06/07/2011 73200 73775 72925 73675 72927 424891 [...]
TAN( value > )
Computes the tangent of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
SQRT( value > )
Computes the square root of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
OFFSET( value >, periods > )
Gets the value offset by the specified number of periods.
Function Parameters Parameter Description value > The value to look up. periods > The number of periods to look back or forward. Note: A negative periods > value retrieves previous values, whereas a positive periods > retrieves forward values (looks ahead). Back to the
POW( value >, power > )
Computes the value raised to the specified power.
Function Parameters Parameter Description value > The value to raise. power > The power to raise the value. Back to the
SIN( value > )
Computes the sine of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
[...] periods > )
Computes the rate of change of the specified value over the specified number of periods.
Function Parameters Parameter Description value > The value to compute the rate of change of. periods > The number of periods to look back while computing the rate of change. Back to the
COS( value > )
Computes the cosine of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
CEILING( value > )
Computes the nearest larger integer to the value. Function Parameters Parameter Description value > The value to compute.
Examples: CEILING(5.8)
Evaluates to 6
CEILING(-5.8)
Evaluates to -5
Back to the
ATAN( value > )
Computes the inverse tangent of the value. Function Parameters Parameter Description value > The value to compute.
Back to the
[...] CROSS_ABOVE( value1 >, value2 > )
Returns 1 when value1 crosses above value2. Returns 0 otherwise. Function Parameters Parameter Description value1 > The first value. value1 > The second value.
Example: CROSS_ABOVE(CLOSE, OPEN)
Back to the
ABS( value > )
Calculates the absolute value of a number. Function Parameters Parameter Description value > The value to compute (e.g. CLOSE , HIGH , (H+L+C)/3 , etc.)
Examples: ABS(5.8)
Evaluates to 5.8
ABS(-5.8)
Evaluates to 5.8 Back to the
[...] specified tick value to a cash value using the conversion parameters defined for the current market. Function Parameters Parameter Description value > The tick value to convert to cash.
Note: You can use the $ shortcut instead of using the full formula name as well:
cashval = $tickval;
Back to the